<?php
/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
include( '../global/initialize.php' );

aos_header( 'Translate' );
global $language;

$language_info = translations_get_language_information( $language );

$approve_link = '';
$edit_link = '';
$query = "SELECT admin FROM users WHERE user_id = " . $_SESSION[ 'user_id' ];
$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
$row = mysql_fetch_array($result, MYSQL_ASSOC);
if( ( isset( $row[ 'admin' ] ) && $row[ 'admin' ] == 1 ) || $language_info[ 'user_id' ] == $_SESSION[ 'user_id' ] ) {
	$approve_link = ' - <a href="moderate_translation.php?page=1&type=approve">' . translate( 'Approve' ) . '</a>';
	$edit_link = ' - <a href="moderate_translation.php?page=1&type=edit">' . translate( 'Edit' ) . '</a>';
	$is_moderator = true;
}
else {
	$is_moderator = false;
}

$query = "SELECT username " .
		"FROM users " .
		"WHERE user_id = " . $language_info[ 'user_id' ];
$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
$row = mysql_fetch_array( $result, MYSQL_ASSOC );
$moderator = $row[ 'username' ];
?>
					<div class="blok">
						<strong><?php transprint( 'Language statistics' ); ?></strong><br />
						<?php transprint( 'Current language' ); ?>: <?php print( $language_info[ 'title' ] ); ?><br />
						<?php transprint( 'Acronym' ); ?>: <?php print( $language_info[ 'language' ] ); ?><br />
						<?php transprint( 'Language moderator' ); ?>: <?php print( $moderator ); ?><br />
						<?php transprint( 'Translated' ); ?>: <?php print( $language_info[ 'translated' ] ); ?><br />
						<?php transprint( 'Approved' ); ?>: <?php print( $language_info[ 'approved' ] . $edit_link ); ?><br />
						<?php transprint( 'Awaiting approval' ); ?>: <?php print( $language_info[ 'pending' ] . $approve_link ); ?><br />
						<?php transprint( 'Not translated yet' ); ?>: <?php print( $language_info[ 'untranslated' ] ); ?> - <a href="translate_text.php"><?php transprint( 'Translate' ); ?></a><br />
					</div>
					<br />
<?php 
if( isset( $_SESSION[ 'translate_status' ] ) ) {
	print( "\t\t\t\t<div class=\"blok\">\r\n\t\t\t\t" . $_SESSION[ 'translate_status' ] . "\r\n\t\t\t\t</div><br />\r\n" );
	unset( $_SESSION[ 'translate_status' ] );
}
if( $language_info[ 'untranslated' ] > 0 ) {
?>
					<div class="blok translation-container">
						<strong><?php transprint( 'Help with the translation' ); ?></strong><br />
						<?php translations_print_translate_form( translations_get_random_untranslated( $language ), 'submit_translation.php', $is_moderator ); ?>
						<br />
						<br />
						<?php transprint( 'Want to translate more? <a href="translate_text.php">Here</a> you can see all texts which have to be translated.' );  ?>
					</div>
<?php
}
else {
?>
					<div class="blok">
						<strong><?php transprint( 'All text is translated' ); ?></strong><br />
						<?php transprint( 'It could be some text is still awaiting approval and some parts of the site are not yet made ready to be translated.' ); ?><br />
						<?php transprint( 'But all that can currently be translated is translated.' ); ?><br />
					</div>
<?php
}
aos_footer();
?>